package com.myhexin.globalbroker.rwa.interfaces.rest.vo;

import com.myhexin.globalbroker.rwa.entity.constants.RetCodeConstants;
import lombok.Getter;

/**
 * @auther zhangzhonglv@myhexin.com
 * @date 2025/9/29
 */
@Getter
public class BaseVo<T> {
    private int code;
    private String message;
    private T data;

    private BaseVo() {}

    private BaseVo(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> BaseVo<T> success() {
        return new BaseVo<>(RetCodeConstants.SUCCESS, "ok", null);
    }

    public static <T> BaseVo<T> success(T data) {
        return new BaseVo<>(RetCodeConstants.SUCCESS, "ok", data);
    }

    public static <T> BaseVo<T> error(int code, String message) {
        return new BaseVo<>(code, message, null);
    }
}
